<?php
/**
 * Make sure we get to see errors
 */
ini_set('display_errors', 1);

/*
 * Determine the root, library, and tests directories of the distribution.
 */
$appRoot = realpath(dirname(__FILE__) . '/..');

/**
 * Setup some include paths
 */
set_include_path('.'
    . PATH_SEPARATOR . $appRoot . '/library'
    . PATH_SEPARATOR . $appRoot . '/tests/library'
    . PATH_SEPARATOR . get_include_path()
);

require_once('Extdb/Loader.php');
spl_autoload_register('Extdb_Loader::autoload');

/**
 * Load the user-defined test configuration file.
 */
if (file_exists('TestConfiguration.php')) {
    require_once 'TestConfiguration.php';
} else {
    require_once 'TestConfiguration.php.dist';
}

/**
 * Add Maxemail library/ directory to the PHPUnit code coverage
 * whitelist. This has the effect that only production code source files appear
 * in the code coverage report and that all production code source files, even
 * those that are not covered by a test yet, are processed.
 */
PHPUnit_Util_Filter::addDirectoryToWhitelist($appRoot . '/library');

unset($appRoot);